package com.kedi.evergreenschoolcenter.service.impl;

import java.util.List;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kedi.evergreenschoolcenter.read.dao.mapper.ReadOnlineClassMapper;
import com.kedi.evergreenschoolcenter.service.OnlineclassService;
import com.kedi.evergreenschoolcenter.writer.dao.mapper.WriterOnlineClassMapper;

/**
 * 
 *
 * @ClassName	OnlineclassService
 * @author: 	陈辽逊
 * @date: 		2019/7/26	11:01
 */
@Service
public class OnlineclassServiceimpl implements OnlineclassService{

	@Autowired
	ReadOnlineClassMapper rmapper;
	@Autowired
	WriterOnlineClassMapper wmapper;
	@Override
	public List<Map<String, Object>> calss() {
		return rmapper.calss();
	}
	
	/**
	 * 				获取书法总条数
	 * @return		getsmyyid
	 */
	@Override
	public int getsfid(int total_page,int limit) {
		if (total_page !=0 && limit !=0) {
			int page = (total_page - 1) * limit;
			return rmapper.getsfid(page,limit);
		}else {
			return 0;
		}
	}
	/**
	 * 				根据书法id返回报名电话
	 * @param id
	 * @return		getsfphone
	 */
	@Override
	public int getsfphone(int id) {
		if (id != 0) {
			return rmapper.getsfphone(id);
		}else {
			return 0;
		}
	}
	
	/**
	 * 				获取舞蹈总条数
	 * @return		getsmyyid
	 */
	@Override
	public int getwdid(int total_page,int limit) {
		if (total_page !=0 && limit !=0) {
			int page = (total_page - 1) * limit;
			return rmapper.getwdid(page,limit);
		}else {
			return 0;
		}
	}

	/**
	 * 				根据舞蹈id返回报名电话
	 * @param id
	 * @return		getwdphone
	 */
	@Override
	public int getwdphone(int id) {
		if (id != 0) {
			return rmapper.getwdphone(id);
		}else {
			return 0;
		}
	}
	
	/**
	 * 				获取手工艺总条数
	 * @return		getsmyyid
	 */
	@Override
	public int getsgyid(int total_page,int limit) {
		if (total_page !=0 && limit !=0) {
			int page = (total_page - 1) * limit;
			return rmapper.getsgyid(page,limit);
		}else {
			return 0;
		}
	}
	/**
	 * 				根据手工艺id返回报名电话
	 * @param id
	 * @return		getsgyphone
	 */
	@Override
	public int getsgyphone(int id) {
		if (id != 0) {
			return rmapper.getsgyphone(id);
		}else {
			return 0;
		}
	}
	/**
	 * 				获取数码应用总条数
	 * @return		getsmyyid
	 */
	@Override
	public int getsmyyid(int total_page,int limit) {
		if (total_page !=0 && limit !=0) {
			int page = (total_page - 1) * limit;
			return rmapper.getsmyyid(page,limit);
		}else {
			return 0;
		}
	}
	/**
	 * 				根据数码应用id返回报名电话
	 * @param id
	 * @return		getsmyyphone
	 */
	@Override
	public int getsmyyphone(int id) {
		if (id != 0) {
			return rmapper.getsmyyphone(id);
		}else {
			return 0;
		}
	}
	/**
	 * 				根据类型获取在线课堂所有数据
	 * @param		calss
	 * @return		online
	 */
	@Override
	public List<Map<String, Object>> online(String title) {
		return rmapper.online(title);
	}
	/**
	 * 				 根据在线课堂id进行点赞
	 * @param 		 id
	 * @return		 updatelikenum
	 */
	@Override
	public int updatepraisenum(int id) {
		return wmapper.updatepraisenum(id);
	}
	/**
	 * 				 根据在线课堂id进行收藏
	 * @param 		 id
	 * @return		 updatelikenum
	 */
	@Override
	public int updatecollectnum(int id) {
		return  wmapper.updatecollectnum(id);
	}
}
